// ==UserScript==
// @name           Table Sorter
// @namespace      http://glenncarr.com/greasemonkey/yahoofantasy
// @description    Makes tables sortable
// @include        *
// ==/UserScript==

(function(){

var tableScript = document.createElement('script');
tableScript.src  = 'http://yahoofantasybrowsertools.googlecode.com/svn/trunk/TableSorter/src/sorttable.js';
document.body.appendChild( tableScript );

var tables = document.evaluate(
    "//table",
    document,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null);
for ( var i = 0; i < tables.snapshotLength; i++ )
{
    var table = tables.snapshotItem( i );
    var class = table.getAttribute( "class" );
    if ( class == null || class == "" )
        class = "sortable";
    else
        class += " sortable";
    table.setAttribute( "class", class );
}

})();